Skip to content

SONARJAVA-6592 Test ruling sync action#5762

Draft
romainbrenguier wants to merge 13 commits into
masterfrom
romain/test-ruling-sync-action
Draft

SONARJAVA-6592 Test ruling sync action#5762
romainbrenguier wants to merge 13 commits into
masterfrom
romain/test-ruling-sync-action

Conversation

@romainbrenguier

@romainbrenguier romainbrenguier commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Part of


Summary by Gitar

  • CI/CD workflows:
    • Added ruling-diff-comment.yml to post comments on PRs when ruling JSON files change.
    • Added ruling-update-notify job to build.yml to support automated ruling synchronization and failure notifications.
  • Test optimizations:
    • Ignored several test cases in JavaRulingTest.java using @Ignore to accelerate CI cycles.
  • Ruling configuration:
    • Updated various JSON expectation files in its/ruling/src/test/resources/ including java-S1134.json, java-S1448.json, and added java-S1234.json.
    • Removed java-S1488.json from its/ruling/src/test/resources/commons-beanutils/.

This will update automatically on new commits.

@hashicorp-vault-sonar-prod hashicorp-vault-sonar-prod Bot changed the title Test ruling sync action SONARJAVA-6592 Test ruling sync action Jul 9, 2026
@hashicorp-vault-sonar-prod

hashicorp-vault-sonar-prod Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

SONARJAVA-6592

Comment thread its/ruling/src/test/resources/commons-beanutils/java-S1448.json Outdated
@gitar-bot

gitar-bot Bot commented Jul 9, 2026

Copy link
Copy Markdown
Code Review ✅ Approved 1 resolved / 1 findings

Integrates automated ruling diff and notification workflows while optimizing test execution. The malformed JSON in java-S1448.json has been corrected, and no further issues were found.

✅ 1 resolved
Bug: java-S1448.json is invalid JSON (missing opening brace)

📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:1 📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:5
In its/ruling/src/test/resources/commons-beanutils/java-S1448.json, the diff removed the opening { (replaced with a blank line) but left the closing } on line 5. The resulting file is:


"commons-beanutils:...PropertyUtilsBean.java": [
93
]
}

This is not valid JSON — it lacks the opening brace, so any JSON parser (e.g. the LITS plugin reading expected ruling results) will fail to parse it. Restore the opening { on line 1.

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@github-actions

github-actions Bot commented Jul 9, 2026

Copy link
Copy Markdown
Contributor

Ruling Diff Summary

Detected changes in 3 rule files: 16 issues removed, 4 issues added.

S1134 (java) on commons-beanutils - 4 issues removed, 3 issues added

Added src/main/java/org/apache/commons/beanutils2/BasicDynaClass.java (line 215)

       210 |      *  constructor is not accessible
       211 |      * @throws InstantiationException if this Class represents an abstract
       212 |      *  class, an array class, a primitive type, or void; or if instantiation
       213 |      *  fails for some other reason
       214 |      */
>>>    215 |     @Override
       216 |     public DynaBean newInstance()
       217 |             throws IllegalAccessException, InstantiationException {
       218 | 
       219 |         try {
       220 |             // Refind the constructor after a deserialization (if needed)

Removed src/main/java/org/apache/commons/beanutils2/BeanUtilsBean.java (line 213)

       208 |      *
       209 |      * <p>If you know that no type conversions are required, the
       210 |      * <code>copyProperties()</code> method in {@link PropertyUtils} will
       211 |      * execute faster than this method.</p>
       212 |      *
>>>    213 |      * <p><strong>FIXME</strong> - Indexed and mapped properties that do not
       214 |      * have getter and setter methods for the underlying array or Map are not
       215 |      * copied by this method.</p>
       216 |      *
       217 |      * @param dest Destination bean whose properties are modified
       218 |      * @param orig Origin bean whose properties are retrieved

Removed src/main/java/org/apache/commons/beanutils2/DynaClass.java (line 60)

        55 |     /**
        56 |      * <p>Returns an array of {@code ProperyDescriptors} for the properties
        57 |      * currently defined in this DynaClass.  If no properties are defined, a
        58 |      * zero-length array will be returned.</p>
        59 |      *
>>>     60 |      * <p><strong>FIXME</strong> - Should we really be implementing
        61 |      * {@code getBeanInfo()} instead, which returns property descriptors
        62 |      * and a bunch of other stuff?</p>
        63 |      *
        64 |      * @return the set of properties for this DynaClass
        65 |      */

Removed src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 722)

       717 | 
       718 | 
       719 |     /**
       720 |      * <p>Return the mapped property descriptors for this bean.</p>
       721 |      *
>>>    722 |      * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p>
       723 |      *
       724 |      * @param bean Bean to be introspected
       725 |      * @return the mapped property descriptors
       726 |      */
       727 |     Map getMappedPropertyDescriptors(final Object bean) {

Removed src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 1182)

      1177 | 
      1178 |     /**
      1179 |      * <p>Return an accessible property getter method for this property,
      1180 |      * if there is one; otherwise return <code>null</code>.</p>
      1181 |      *
>>>   1182 |      * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p>
      1183 |      *
      1184 |      * @param clazz The class of the read method will be invoked on
      1185 |      * @param descriptor Property descriptor to return a getter for
      1186 |      * @return The read method
      1187 |      */

Added src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 719)

       714 |         return mappedDescriptorsCache.get(beanClass);
       715 | 
       716 |     }
       717 | 
       718 | 
>>>    719 |     /**
       720 |      * <p>Return the mapped property descriptors for this bean.</p>
       721 |      *
       722 |      * <p><strong>FIXME</strong> - Does not work with DynaBeans.</p>
       723 |      *
       724 |      * @param bean Bean to be introspected

Added src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 1203)

      1198 |      * @param name Name of the property to be extracted
      1199 |      * @return The property value
      1200 |      *
      1201 |      * @throws IllegalAccessException if the caller does not have
      1202 |      *  access to the property accessor method
>>>   1203 |      * @throws IllegalArgumentException if <code>bean</code> or
      1204 |      *  <code>name</code> is null
      1205 |      * @throws IllegalArgumentException if the property name
      1206 |      *  is nested or indexed
      1207 |      * @throws InvocationTargetException if the property accessor method
      1208 |      *  throws an exception
S1488 (java) on commons-beanutils - 12 issues removed, 0 issues added - deleted ruling file

Removed src/main/java/org/apache/commons/beanutils2/BeanMap.java (line 766)

       761 |                     if ( ! paramType.isAssignableFrom( value.getClass() ) ) {
       762 |                         value = convertType( paramType, value );
       763 |                     }
       764 |                 }
       765 |             }
>>>    766 |             final Object[] answer = { value };
       767 |             return answer;
       768 |         }
       769 |         catch ( final InvocationTargetException e ) {
       770 |             final IllegalArgumentException iae = new IllegalArgumentException(e.getMessage());
       771 |             if (BeanUtils.initCause(iae, e) == false) {

Removed src/main/java/org/apache/commons/beanutils2/PropertyUtilsBean.java (line 1265)

      1260 |             throw new NoSuchMethodException("Property '" + name +
      1261 |                     "' has no getter method in class '" + bean.getClass() + "'");
      1262 |         }
      1263 | 
      1264 |         // Call the property getter and return the value
>>>   1265 |         final Object value = invokeMethod(readMethod, bean, EMPTY_OBJECT_ARRAY);
      1266 |         return value;
      1267 | 
      1268 |     }
      1269 | 
      1270 | 

Removed src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java (line 528)

       523 |     private Calendar parse(final Class<?> sourceType, final Class<?> targetType, final String value) throws Exception {
       524 |         Exception firstEx = null;
       525 |         for (final String pattern : patterns) {
       526 |             try {
       527 |                 final DateFormat format = getFormat(pattern);
>>>    528 |                 final Calendar calendar = parse(sourceType, targetType, value, format);
       529 |                 return calendar;
       530 |             } catch (final Exception ex) {
       531 |                 if (firstEx == null) {
       532 |                     firstEx = ex;
       533 |                 }

Removed src/main/java/org/apache/commons/beanutils2/converters/DateTimeConverter.java (line 570)

       565 |             if (log().isDebugEnabled()) {
       566 |                 log().debug("    " + msg);
       567 |             }
       568 |             throw new ConversionException(msg);
       569 |         }
>>>    570 |         final Calendar calendar = format.getCalendar();
       571 |         return calendar;
       572 |     }
       573 | 
       574 |     /**
       575 |      * Provide a String representation of this date/time converter.

Removed src/test/java/org/apache/commons/beanutils2/BasicDynaBeanTestCase.java (line 986)

       981 |     protected DynaClass createDynaClass() {
       982 | 
       983 |         final int intArray[] = new int[0];
       984 |         final String stringArray[] = new String[0];
       985 | 
>>>    986 |         final DynaClass dynaClass = new BasicDynaClass
       987 |                 ("TestDynaClass", null,
       988 |                         new DynaProperty[]{
       989 |                             new DynaProperty("booleanProperty", Boolean.TYPE),
       990 |                             new DynaProperty("booleanSecond", Boolean.TYPE),
       991 |                             new DynaProperty("doubleProperty", Double.TYPE),

Removed src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java (line 181)

       176 |     //
       177 |     // Then, I manually added the "class" key, which is a property that exists for
       178 |     // all beans (and all objects for that matter.
       179 |     @Override
       180 |     public Object[] getSampleKeys() {
>>>    181 |         final Object[] keys = new Object[] {
       182 |             "someIntValue",
       183 |             "someLongValue",
       184 |             "someDoubleValue",
       185 |             "someFloatValue",
       186 |             "someShortValue",

Removed src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java (line 208)

       203 |     private final Object objectInFullMap = new Object();
       204 | 
       205 |     // note to self: the sample values were created manually
       206 |     @Override
       207 |     public Object[] getSampleValues() {
>>>    208 |         final Object[] values = new Object[] {
       209 |             new Integer(1234),
       210 |             new Long(1298341928234L),
       211 |             new Double(123423.34),
       212 |             new Float(1213332.12f),
       213 |             new Short((short)134),

Removed src/test/java/org/apache/commons/beanutils2/BeanMapTestCase.java (line 226)

       221 |         return values;
       222 |     }
       223 | 
       224 |     @Override
       225 |     public Object[] getNewSampleValues() {
>>>    226 |         final Object[] values = new Object[] {
       227 |             new Integer(223),
       228 |             new Long(23341928234L),
       229 |             new Double(23423.34),
       230 |             new Float(213332.12f),
       231 |             new Short((short)234),

Removed src/test/java/org/apache/commons/beanutils2/DynaBeanUtilsTestCase.java (line 1237)

      1232 |     protected static DynaClass createDynaClass() {
      1233 | 
      1234 |         final int intArray[] = new int[0];
      1235 |         final String stringArray[] = new String[0];
      1236 | 
>>>   1237 |         final DynaClass dynaClass = new BasicDynaClass
      1238 |                 ("TestDynaClass", null,
      1239 |                         new DynaProperty[]{
      1240 |                             new DynaProperty("booleanProperty", Boolean.TYPE),
      1241 |                             new DynaProperty("booleanSecond", Boolean.TYPE),
      1242 |                             new DynaProperty("byteProperty", Byte.TYPE),

Removed src/test/java/org/apache/commons/beanutils2/DynaPropertyUtilsTestCase.java (line 2614)

      2609 |     protected DynaClass createDynaClass() {
      2610 | 
      2611 |         final int intArray[] = new int[0];
      2612 |         final String stringArray[] = new String[0];
      2613 | 
>>>   2614 |         final DynaClass dynaClass = new BasicDynaClass
      2615 |                 ("TestDynaClass", null,
      2616 |                         new DynaProperty[]{
      2617 |                             new DynaProperty("booleanProperty", Boolean.TYPE),
      2618 |                             new DynaProperty("booleanSecond", Boolean.TYPE),
      2619 |                             new DynaProperty("doubleProperty", Double.TYPE),

Removed src/test/java/org/apache/commons/beanutils2/bugs/Jira347TestCase.java (line 150)

       145 |             }
       146 |         }
       147 |         final String classLocation = newString.toString();
       148 |         //System.out.println("classlocation: " + classLocation);
       149 | 
>>>    150 |         final URLClassLoader theLoader = URLClassLoader.newInstance(new URL[]{new URL(classLocation)},null);
       151 |         return theLoader;
       152 |     }
       153 | }

Removed src/test/java/org/apache/commons/beanutils2/memoryleaktests/MemoryLeakTestCase.java (line 528)

       523 |             }
       524 |         }
       525 |         final String classLocation = newString.toString();
       526 |         //System.out.println("classlocation: " + classLocation);
       527 | 
>>>    528 |         final URLClassLoader theLoader = URLClassLoader.newInstance(new URL[]{new URL(classLocation)},null);
       529 |         return theLoader;
       530 |     }
       531 | 
       532 |     /**
       533 |      * Produces a profiler report about where the leaks are.
S1234 (java) on test-project - 0 issues removed, 1 issues added - new ruling file

Added test.java (line 42)

(source file not found at this revision: test.java)

@romainbrenguier romainbrenguier force-pushed the romain/test-ruling-sync-action branch from 2ecd11c to 1c3e3bf Compare July 9, 2026 11:28
romainbrenguier and others added 13 commits July 10, 2026 17:34
Based on action from core-languages-tooling.
- Exclude most ruling tests (guava, mall, jetty, etc.) using @ignore
- Keep only commons-beanutils test active for PR validation
- Add test changes to commons-beanutils S1134 to demonstrate diff comments

This is a temporary change to speed up CI for demonstrating the
ruling diff comment feature. Not intended for merge to master.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The submodules must be initialized to access source files for
generating code snippets in ruling diff comments.

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The file was missing the opening brace '{', causing JSON parse errors.

Fixed format:
- Before: "key": [values]...
- After: {"key": [values]...}
Integrates the ruling-update-and-notify action to respond to Ruling QA
failures. This job:
- Runs after all ruling-qa matrix jobs complete
- Only runs on pull requests
- Posts ruling diff comments to PRs
- Prepares for future fix PR creation (currently disabled)

The sync-command needs to be implemented to download actual results from
the ruling-qa job artifacts before enabling fix PR creation.
Changed from checking contains(needs.ruling-qa.result, 'failure') to checking
if needs.ruling-qa.result != 'success'. For matrix jobs, the result is only
'success' if ALL matrix jobs succeeded, otherwise it's 'failure'.
Removed complex sync-command - the action now handles artifact download
automatically. The workflow just needs to specify the basic parameters.

This makes integration much cleaner and easier to maintain.
Temporarily keep only one matrix item (without-sonarqube-project on
sonar-m-public) to make testing of the ruling-update-notify action
faster and simpler.
@romainbrenguier romainbrenguier force-pushed the romain/test-ruling-sync-action branch from 08cf3c9 to 87da5e4 Compare July 10, 2026 15:35
@github-actions

Copy link
Copy Markdown
Contributor

Ruling needs updating. A fix PR has been created: #5773

Please review and merge it into your branch.

@gitar-bot

gitar-bot Bot commented Jul 10, 2026

Copy link
Copy Markdown
CI failed: The build failed due to malformed JSON in ruling files and test regressions in `JavaRulingTest` caused by out-of-sync baseline data, alongside a syntax error in a custom GitHub Actions workflow.

Overview

Multiple critical failures were identified: a GitHub Actions workflow configuration error, malformed JSON in test ruling files, and regressions in JavaRulingTest where analysis outputs mismatch expected baselines. Total analysis included 39 logs across several parallel jobs.

Failures

Workflow Syntax Error (confidence: high)

  • Type: configuration
  • Affected jobs: [86090035057]
  • Related to change: yes
  • Root cause: The ruling-update-and-notify/action.yml file uses an invalid inputs.action-ref expression, which is not permitted in the current workflow scope.
  • Suggested fix: Review ruling-update-and-notify/action.yml and ensure inputs are correctly defined and scoped, or pass the reference as a direct parameter.

Ruling JSON Malformation (confidence: high)

  • Type: build
  • Affected jobs: [86092401590]
  • Related to change: yes
  • Root cause: The ruling-diff-comment utility failed during JSON parsing due to malformed content in ruling files (e.g., "Extra data" error at line 2) within the its/ruling directory.
  • Suggested fix: Validate and correct the JSON structure in the modified ruling files in its/ruling/src/test/resources/.

JavaRulingTest Regression (confidence: high)

  • Type: test
  • Affected jobs: [Multiple Windows jobs]
  • Related to change: yes
  • Root cause: JavaRulingTest detected 19 differences between actual analysis results and the expected baseline in its/ruling/src/test/resources/commons-beanutils, indicating the PR's changes altered analysis results that haven't been baselined.
  • Suggested fix: Inspect the generated diffs in target/test.diff. If the changes in analysis output are intentional, update the baseline files in its/ruling/src/test/resources/commons-beanutils/ to match the current output.

Summary

  • Change-related failures: 3 (Workflow syntax, malformed JSON, and test regressions).
  • Infrastructure/flaky failures: 0 (Some warnings observed regarding Develocity connection and node version deprecation, but not the primary cause of failure).
  • Recommended action: First, fix the JSON syntax in the modified ruling files. Second, rerun the tests to confirm if the JavaRulingTest failures are solely due to stale baselines. Finally, correct the action.yml syntax error.
Code Review ✅ Approved 1 resolved / 1 findings

Introduces automated ruling synchronization and diff commenting workflows while optimizing CI test cycles. The malformed JSON in java-S1448.json has been corrected.

✅ 1 resolved
Bug: java-S1448.json is invalid JSON (missing opening brace)

📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:1 📄 its/ruling/src/test/resources/commons-beanutils/java-S1448.json:5
In its/ruling/src/test/resources/commons-beanutils/java-S1448.json, the diff removed the opening { (replaced with a blank line) but left the closing } on line 5. The resulting file is:


"commons-beanutils:...PropertyUtilsBean.java": [
93
]
}

This is not valid JSON — it lacks the opening brace, so any JSON parser (e.g. the LITS plugin reading expected ruling results) will fail to parse it. Restore the opening { on line 1.

Tip

Comment Gitar fix CI or enable auto-apply: gitar auto-apply:on

Options

Auto-apply is off → Gitar will not commit updates to this branch.
Display: compact → Showing less information.

Comment with these commands to change the behavior for this request:

Auto-apply Compact
gitar auto-apply:on         
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Gitar

@sonarqube-next

Copy link
Copy Markdown

Quality Gate failed Quality Gate failed

Failed conditions
2 New issues

See analysis details on SonarQube

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant